﻿using System.Globalization;

namespace TSharp.Core.Mvc.Web
{
    /// <summary>
    ///     区域语言选项
    ///     <para>2010/10/27</para>
    ///     <para>TANGJINGBO</para>
    ///     <author>tangjingbo</author>
    /// </summary>
    public class Culture
    {
        /// <summary>
        ///     区域标识
        /// </summary>
        /// <value>The name.</value>
        public string Name { get; set; }

        /// <summary>
        ///     区域名称
        /// </summary>
        /// <value>The title.</value>
        public string Title { get; set; }

        /// <summary>
        ///     显示顺序
        /// </summary>
        /// <value>The order.</value>
        public int Order { get; set; }

        /// <summary>
        ///     Toes the culture info.
        /// </summary>
        public CultureInfo ToCultureInfo()
        {
            if (!string.IsNullOrEmpty(Name))
                try
                {
                    return new CultureInfo(Name);
                }
                catch
                {
                    return CultureInfo.CurrentUICulture;
                }
            return CultureInfo.CurrentUICulture;
        }
    }
}